<template>
  <div>
    <el-breadcrumb separator="/" style="margin-bottom: 20px;">
      <el-breadcrumb-item :to="{ path: '/' }">用户管理</el-breadcrumb-item>
      <el-breadcrumb-item :to="{ path: '/user/list' }">用户列表</el-breadcrumb-item>
      <el-breadcrumb-item>用户详情</el-breadcrumb-item>
    </el-breadcrumb>
    <el-card>
      <el-row style="text-align: right">
        <el-button type="primary" @click="reset">返回</el-button>
      </el-row>
      <el-col :lg="8" :md="16" :sm="24" :xs="24">
        <el-form ref="userFormRef" :model="userForm" label-width="120px">
          <el-form-item label="姓名">
            <el-input readonly v-model="userForm.name"></el-input>
          </el-form-item>
          <el-form-item label="性别">
            <el-input readonly v-model="userForm.sex"></el-input>
          </el-form-item>
          <el-form-item label="年龄">
            <el-input readonly v-model="userForm.age"></el-input>
          </el-form-item>
          <el-form-item label="身份证号">
            <el-input readonly v-model="userForm.number"></el-input>
          </el-form-item>
          <el-form-item label="电话号码">
            <el-input readonly v-model="userForm.telephone"></el-input>
          </el-form-item>
          <el-form-item label="角色">
            <el-select v-model="userForm.role">
              <el-option label="老师" value="teacher"></el-option>
              <el-option label="学生" value="student"></el-option>
              <el-option label="管理员" value="admin"></el-option>
            </el-select>
          </el-form-item>
           <el-form-item label="地址">
            <el-input readonly v-model="userForm.UserAddress"></el-input>
          </el-form-item>
        </el-form>
      </el-col>
    </el-card>
  </div>
</template>

<script>
export default {
  data() {
    return {
      userForm: {}
    };
  },
  mounted() {
    this.getInformation();
  },
  methods: {
    getInformation() {
      this.$api.get(`/api/user/detail/${this.paramsId}`).then(res => {
        this.userForm = res.data.data;
      });
    },
    reset() {
      this.$router.push({ name: "userlist" });
    }
  },
  computed: {
    paramsId() {
      return this.$route.params.id;
    }
  }
};
</script>

<style scope>
</style>